Skip to content

feat(pairing): handle v2 pairing timeouts and cancellations - #21078

Open
vbudhram wants to merge 1 commit into
fxa-13870-v2from
fxa-13869
Open

feat(pairing): handle v2 pairing timeouts and cancellations#21078
vbudhram wants to merge 1 commit into
fxa-13870-v2from
fxa-13869

Conversation

@vbudhram

@vbudhram vbudhram commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Because

  • When a v2 pairing attempt ended without connecting, both devices landed on the same dead-end screen whether the user cancelled or the channel dropped, the copy could not match what actually happened.
  • The authority showed its QR indefinitely when no device ever scanned it, leaving the user on a screen that would never advance.
  • The supplicant's timeout screen was rendered directly with no container, so it had no way to learn why the flow ended.

This pull request

  • Adds a ?reason=timeout / ?reason=canceled param on both timeout screens, defaulting to timeout when absent, so each side renders the right variant.
  • Adds a 2-minute no-scan timeout in Authority/ScanQR/container.tsx, cleared once a device scans or the flow fails.
  • Sets the cancel reason at each exit point: Authority/ContinueOnMobile, Supplicant/ApproveSignIn, and Supplicant/ConnectThisDevice.
  • Adds Supplicant/TimeoutAndCancel/container.tsx and routes App/index.tsx at it instead of the bare page.
  • Adds container tests for both timeout screens and pairing-flow.test.ts.

Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-13869

Checklist

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

Other information

nx test-unit fxa-settings (Pair/Pair2/integrations/channels): 490 passed, 0 failed.

How to test: start the stack, open /pair/authority/scan_qr in a signed-in Firefox, and leave it untouched for two minutes — it should land on timeout_and_cancel with the timeout copy. Cancelling from continue_on_mobile instead should show the canceled copy.

Note: rebased onto the current fxa-13870 after that branch was force-pushed. The authority side moved from the pairingFlow module to PairingAuthorityIntegration, so wireAbort here is expressed as the AuthorityState.Failed branch, and the two authority container tests were updated to the integration API.

@vbudhram vbudhram self-assigned this Aug 20, 2026
@vbudhram
vbudhram force-pushed the fxa-13870 branch 4 times, most recently from 1282979 to ce30465 Compare August 20, 2026 22:38
@vbudhram
vbudhram force-pushed the fxa-13870 branch 4 times, most recently from f185b1c to 5a5a897 Compare August 21, 2026 17:52
@vbudhram vbudhram changed the title Fxa 13869 feat(pairing): handle v2 pairing timeouts and cancellations Aug 24, 2026
@vbudhram
vbudhram marked this pull request as ready for review August 24, 2026 20:58
@vbudhram
vbudhram requested a review from a team as a code owner August 24, 2026 20:58
Copilot AI balanced review requested due to automatic review settings August 24, 2026 20:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds cause-specific timeout/cancellation screens to the v2 pairing flow and prevents QR screens from waiting indefinitely.

Changes:

  • Propagates and renders timeout versus cancellation reasons.
  • Adds a two-minute authority QR timeout.
  • Adds container and channel teardown tests.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Supplicant/TimeoutAndCancel/container.tsx Selects the interruption variant from the URL.
Supplicant/TimeoutAndCancel/container.test.tsx Tests reason parsing and fallbacks.
Supplicant/ConnectThisDevice/container.tsx Adds interruption reasons to exit routes.
Supplicant/ApproveSignIn/container.tsx Distinguishes cancellation from channel failure.
Authority/TimeoutAndCancel/container.tsx Selects the variant and wires actions.
Authority/TimeoutAndCancel/container.test.tsx Tests variants and actions.
Authority/ScanQR/container.tsx Adds the no-scan timeout.
Authority/ScanQR/container.test.tsx Updates failure navigation coverage.
Authority/ContinueOnMobile/container.tsx Marks user cancellation explicitly.
pairing-flow.test.ts Tests channel and handshake cleanup.
App/index.tsx Routes the supplicant screen through its container.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +68 to +71
inactivityTimer = setTimeout(
() => navigate('/pair/authority/timeout_and_cancel?reason=timeout'),
SCAN_QR_TIMEOUT_MS
);
Comment on lines +40 to +42
navigateWithQuery(
'/pair/supplicant/timeout_and_cancel?reason=canceled'
);
Comment on lines +68 to +71
inactivityTimer = setTimeout(
() => navigate('/pair/authority/timeout_and_cancel?reason=timeout'),
SCAN_QR_TIMEOUT_MS
);
Because:
- FXA-13869 needs the v2 pairing flow to end cleanly on a timeout or a
  cancel, close the channel, and tell the user why.

This commit:
- adds a supplicant timeout_and_cancel container and passes the reason to
  the authority container, so both dead-end screens show timeout or canceled.
- sends reason=canceled from cancel buttons and reason=timeout from channel
  disconnects and the no-scan inactivity timeout.
- adds Jest tests for both containers and for the channel teardown on reset.
@vbudhram
vbudhram changed the base branch from fxa-13870 to fxa-13870-v2 August 24, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants